import { MutationTree } from 'vuex';
import { Api, CarMessage, cartypeRelation, Sphinx, UserData, UserDetail, Protocol, Chain, SystemInfo, OrderInfo } from './state';

const mutation: MutationTree<Sphinx> = {
  updateServerGeneralStat(state: Sphinx,serverGeneralStat: boolean) {
    state.serverGeneralStat = serverGeneralStat
  },
  upratePrevUrl(state: Sphinx,prevUrl:string) {
    state.prevUrl = prevUrl
  },
  updateCurrentOptEntity(state: Sphinx,currentOptEntity:any) {
    state.currentOptEntity = currentOptEntity;
  },
  updatePrevOptEntity(state: Sphinx, prevOptEntity:any) {
    state.prevOptEntity = prevOptEntity
  },
  updatePrevOpt(state: Sphinx, prevOpt:any) {
    state.prevOpt = prevOpt;
  },
  updateRouterPath(state: Sphinx, routerPaths:string[]) {
    state.routerPath = routerPaths;
  },
  updateParentEntity(state: Sphinx, parentEntity:[{entityCode: string,childCode: string}]) {
    state.parentEntity = parentEntity;
  },
  updateSelectedItemData(state: Sphinx, p:[]) {
    state.selectedItemData = p;
  },
  updateUserState(state: Sphinx, userData: UserData) {
    state.userData = userData;
  },
  updateApiState(state: Sphinx, apis: Api[]) {
    state.api = apis;
  },
  updateUserDetailState(state: Sphinx, userDatail: UserDetail) {
    // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
    state.UserDetail = userDatail;
  },
  updateCarstate(state: Sphinx, CarMessage: CarMessage) {
    state.CarMessage = CarMessage;
  },
  updateRelation(state: Sphinx, cartypeRelation: cartypeRelation) {
    state.cartypeRelation = cartypeRelation;
  },
  storeProtocol(state: Sphinx, Protocol: Protocol) {
    state.Protocol = Protocol;
  },
  storeChain(state: Sphinx, Chain: Chain) {
    state.Chain = Chain;
  },
  storeSystemInfo(state: Sphinx, SystemInfo: SystemInfo) {
    state.SystemInfo = SystemInfo
  },
  storeOrderInfo(state: Sphinx, OrderInfo: OrderInfo) {
    state.OrderInfo = OrderInfo
  },
  updateUrls(state: Sphinx, urls: string[]) {
    state.imgUrls = urls
  }
};

export default mutation;
